﻿using System;

namespace Dexter.Domain.Model {
	public partial class LegacyUrl {
		/// <summary>
		/// Creates a new instance of <see cref="LegacyUrl"/>.
		/// </summary>
		/// <param name="source">The source.</param>
		/// <param name="target">The target.</param>
		/// <param name="redirectType">Type of the redirect.</param>
		/// <returns>
		/// A new instance of <see cref="LegacyUrl"/>
		/// </returns>
		/// <exception cref="ArgumentNullException"> If <paramref name="source"/> is <c>null</c>.</exception>
		/// <exception cref="ArgumentException"> If <paramref name="source"/> is empty.</exception>
		/// <exception cref="ArgumentNullException"> If <paramref name="target"/> is <c>null</c>.</exception>
		public static LegacyUrl CreateNewLegacyUrl(string source, Uri target, RedirectType redirectType)
		{
			if (string.IsNullOrEmpty(source))
				throw new ArgumentException("source", "Invalid SourceUrl");

			if (source == null)
				throw new ArgumentNullException("source", "Invalid SourceUrl");

			if (target == null)
				throw new ArgumentNullException("target", "Invalid SourceUrl");

			return new LegacyUrl(source, target, redirectType);
		}
	}
}